package com.example.springbootdemo.api

import com.example.springbootdemo.defination.CustomError
import com.example.springbootdemo.defination.CustomException
import com.example.springbootdemo.defination.CustomResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController
import java.lang.NullPointerException

@RestController("/t")
class TestApi {
    @GetMapping("")
    fun test() = CustomResponse()

    @GetMapping("/1")
    fun getNullPointerException(): Any = throw NullPointerException()

    @GetMapping("/2")
    fun alwaysWrong(): Any = throw CustomException(CustomError.CustomError1)

    @GetMapping("/3{input}")
    fun mirror(@PathVariable input: Any): Any = CustomResponse(input)
}